/*
 * @(#)TestMultiSets.java    May 21, 2010
 *
 * Copyright 2009 Nyber Shanghai, Inc. All rights reserved.
 */

package com.lab.google.collect;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;

/**
 * Immutable能"保证不可改变", "极易使用", "更快", "使用更少的内存".
 * 
 * ImmutableMap: 键不能重复
 *
 * @author nickevin@gmail.com
 * @version May 21, 2010 2:33:40 PM
 */

public class Immutable {

	@Test
	public void testImmutableMap() throws Exception {
		ImmutableMap<String, Integer> map = ImmutableMap.of("four", 2, "eight",
				8, "twelve", 12, "sixteen", 16, "twenty-three", 23);

		assertEquals(5, map.size());
	}

	@Test
	public void testImmutableSet() throws Exception {
		ImmutableSet<Integer> LUCKY_NUMBERS = ImmutableSet.of(4, 8, 15, 16, 23,
				15);

		assertEquals(5, LUCKY_NUMBERS.size());
	}
}
